#pragma once
#include "utils/singleton.h"

class ENGINE_API WinConsole : public Singleton<WinConsole>
{
	
public:
	/// constructor
	WinConsole();
	~WinConsole();
	
	/// called by console to output data
	void print(const String& s);
	/// called by console with serious error
	void error(const String& s);
	/// called by console to output warning
	void warning(const String& s);

	/// return true if input is available
	bool hasInput();
	/// read available input
	String getInput();


	inline bool WinConsole::isOpen();

private:
	HANDLE stdoutHandle;
	HANDLE stdinHandle;
	HANDLE stderrHandle;
};



inline bool WinConsole::isOpen()
{
	return (stdoutHandle!=NULL || stdinHandle!=NULL ||stderrHandle!=NULL);
}
